]> dgit.raspbian.org Git - gnome-shell.git/commit
st-bin: Disallow st_bin_set_child with already-parented children
authorDaniel van Vugt <daniel.van.vugt@canonical.com>
Tue, 24 Nov 2020 09:34:08 +0000 (17:34 +0800)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 26 Nov 2020 12:47:11 +0000 (13:47 +0100)
commit244c266c9f59f1758024deb46a0418efe23243a8
tree0dd2bce1ee997488eb5b446e642c22c474d64f14
parentee0f250662b1f1835c7cda696db32ed0ff3b9ce5
st-bin: Disallow st_bin_set_child with already-parented children

Not checking for this would result in `clutter_actor_add_child`
failing, but StBin keeping a copy in `priv->child`. So later on,
`st_bin_remove` would never be called on it and this assertion
would fail and crash the whole shell:

```
static void
st_bin_destroy (ClutterActor *actor)
{
  StBinPrivate *priv = st_bin_get_instance_private (ST_BIN (actor));

  if (priv->child)
    clutter_actor_destroy (priv->child);
  g_assert (priv->child == NULL);

```

By disallowing spurious `st_bin_set_child` calls we now prevent StBin
from entering such a corrupt state and the above assertion won't fail
anymore.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1507>
src/st/st-bin.c